<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        div {
            width: 100px;
            height: 100px;
            padding: 10px;
            border: 10px solid #000;
            margin: 100px;
            background-color: pink;
        }
    </style>
</head>

<body>

    <div class="box"></div>
    <script>
        var div1 = document.getElementsByTagName("div")[0];

        console.log(div1.offsetHeight); //打印结果：140（100+20+20）
        console.log(typeof div1.offsetHeight); //打印结果：number
    </script>
</body>

</html>